require('../lib/es6-promise.min.js')
const LOGIN={}
import httphelper from '../common/httphelper';
import APIURL from '../const/APIURL'
LOGIN.CheckGuid = function (guid) {
  var p = new Promise(function func(resolve, reject) {
    httphelper.get(APIURL.CHECKGUID + guid).then(function (res) {
      resolve(res)
    }, function (err) {
      reject(err)
    })

  })
  return p;
}
LOGIN.GuestLogin=function(data){
  var p = new Promise(function func(resolve, reject) {
    httphelper.post(APIURL.GUESTLOGIN, data).then(function (res) {
      resolve(res)
    }, function (err) {
      reject(err)
    })
  })
  return p; 
}
LOGIN.GetGuid=function(){
  var p = new Promise(function func(resolve, reject) {
    httphelper.get(APIURL.GETGUID).then(function(res){      
      resolve(res)
    },function(err){
      reject(err)
    })

  })
  return p;
}
LOGIN.CheckLogin = function (data) {
  var p = new Promise(function func(resolve, reject) {
    httphelper.post(APIURL.CHECKLOGIN,data).then(function (res) {
      resolve(res)
    }, function (err) {
      reject(err)
    })

  })
  return p;
}
LOGIN.FangBian = function (data) {
  var p = new Promise(function func(resolve, reject) {
    httphelper.post(APIURL.FANGBIAN, data).then(function (res) {
      resolve(res)
    }, function (err) {
      reject(err)
    })

  })
  return p;
}

export default LOGIN